{include file="public/header"}
<title>添加</title>
</head>
<body>
<style>
</style>

<article class="page-container">

    <form action="" method="post" class="form form-horizontal" id="form-member-add">
        {if condition="$baocun==1 && $state>2"}
        <a class="ch-add zeng" data-id="{$order_id}" data-key="2" href="javascript:;" title="增项">增项</a>
        {/if}

        {if condition="$flag"}
        <div class="title-border">
            <div class="flex1">分类</div>
            <div class="flex2">名称</div>
            <div class="flex1">方量</div>
            <div class="flex1">价格</div>
            <!--<div class="flex1">质保</div>-->
            <div class="flex1">总金额</div>
            {if condition="$baocun==1 && $state>2 && count($chanel) >1"}
            <div class="flex1">操作</div>
            {/if}
        </div>
        {volist name='chanel' id='vo' key='i'}
        <div class="content-border">
            <div class="flex1">{$vo.class_a}</div>
            <div class="flex2">{$vo.class_b}</div>
            <div class="flex1">{$vo.square}/{$vo.company}</div>
            <div class="flex1">{$vo.un_Price}</div>
            <!--<div class="flex1"><?php if($vo['zhi'] ==1){ ?>是<?php }else{ ?>否<?php }?></div>-->
            <div class="flex1">{$vo.to_price}</div>
            {if condition="$baocun==1 && $state>2 && count($chanel) >1 "}
            <div class="flex1"> <a class="ch-button ch-blue edit2"  data-id="{$vo.capital_id}" data-through="{$through_id}" href="javascript:;" title="编辑">编辑</a>
                <a class="ch-button ch-gray del2"  data-id="{$vo.capital_id}"  href="javascript:;" title="删除">删除</a></div>
            {/if}
        </div>
        {/volist}
        <div class="ch-row ch-info-form">
            <p class="flex1">优惠金额：{$envelopes['give_money']}/元</p>
	     
            <div class="flex2" style="text-align: right;">
                合计总价：{$cap-$envelopes['give_money']}/元
            </div>
        </div>
        {else}
        <span>暂无数据</span>
        {/if}
    </form>
</article>
{include file="public/footer"}
<script>
    /**
     * 基建
     */
    $('.page-container').on('click','.edit2',function () {
        var winWidth = $(window).width();
        var areaWidth = "";
        var areaHeight = "";
        if (winWidth > 768) {
            areaWidth = "800px"
            areaHeight = "600px"
        } else {
            areaWidth = '100%'
            areaHeight = '100%'
        }
        var id = $(this).attr('data-id');
        var through_id = $(this).attr('data-through');
        var src = "{:Url('index/order/edit2')}";
        layer.open({
            type: 2,
            area: [areaWidth, areaHeight],
            fix: false,
            maxmin: true,
            shade: 0.4,
            title: '基检编辑',
            content: src + '?type='+through_id+'&order_id=' + id
        });
    });
    /**
     * 远程基建删除
     */
    $('.page-container').on('click','.del2',function () {
        var capital_id = $(this).attr('data-id');
        var key =$(this).attr('key');
        var count =$(this).attr('count');
        var src = "{:Url('index/order/del2')}";
        var ss=0;
        if(count !=1 && key ==1) {
            ss=1;
        }
        layer.confirm('确认要删除该基检么？', function (index) {
            $.ajax({
                type: 'POST',
                url: src,
                dataType: 'json',
                data: {
                    capital_id: capital_id,
                    key: ss,
                },
                success: function (data) {
                    var res = JSON.parse(data);
                    if (res.code == 200) {
                        layer.msg(res.msg, {icon: 1, time: 2000}, function (index, layero) {
                            setTimeout("window.parent.location.reload()", 1);

                        });
                    } else {
                        layer.msg(res.msg, {icon: 5, time: 1000});
                    }

                },
                error: function (data) {
                    console.log(data.msg);
                },
            });
        });
    });
    /**
     * 基建
     */
    $('.page-container').on('click', '.zeng', function () {
        var winWidth = $(window).width();
        var areaWidth = "";
        var areaHeight = "";
        if (winWidth > 768) {
            areaWidth = "800px"
            areaHeight = "600px"
        } else {
            areaWidth = '90%'
            areaHeight = '95%'
        }
        var id = $(this).attr('data-id');
        var type = $(this).attr('data-key');
        var src = "{:Url('index/order/zeng')}";
        layer.open({
            type: 2,
            area: [areaWidth, areaHeight],
            fix: true,
            maxmin: true,
            shade: 0.4,
            title: '增项',
            content: src + '?order_id=' + id + '&type=' + type
        });
    });

</script>
</body>
</html>

